﻿using System;

class CalculateGCD

            // Write a program that calculates the greatest common divisor (GCD) of given two numbers.
            // Use the Euclidean algorithm (find it in Internet).

{
    static void Main(string[] args)
    {
        Console.WriteLine("Enter two positive numbers:");
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = a + b;
        if (a < b)
        {
            a = c - a;
            b = c - b;
        }
        while (b != 0)
        {
            int remainder = a % b;
            if (remainder == 0)
            {
                Console.WriteLine("The greatest common divisor of the two numbers is {0}", b);
                break;
            }
            a = b;
            b = remainder;
        }
    }
}

